package pl.droidsonroids.gif; import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Parcelable; import android.util.AttributeSet; import android.widget.TextView; import defpackage.abpc; import java.io.IOException; public class GifTextView extends TextView { private abpc.b CZK; public GifTextView(Context context) { super(context); } public GifTextView(Context context, AttributeSet attributeSet) { super(context, attributeSet); a(attributeSet, 0, 0); } public GifTextView(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); a(attributeSet, i, 0); } public GifTextView(Context context, AttributeSet attributeSet, int i, int i2) { super(context, attributeSet, i, i2); a(attributeSet, i, i2); } private void a(AttributeSet attributeSet, int i, int i2) { if (attributeSet != null) { Drawable aAh = aAh(attributeSet.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "drawableLeft", 0)); Drawable aAh2 = aAh(attributeSet.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "drawableTop", 0)); Drawable aAh3 = aAh(attributeSet.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "drawableRight", 0)); Drawable aAh4 = aAh(attributeSet.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "drawableBottom", 0)); Drawable aAh5 = aAh(attributeSet.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "drawableStart", 0)); Drawable aAh6 = aAh(attributeSet.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "drawableEnd", 0)); if (Build.VERSION.SDK_INT >= 17) { if (getLayoutDirection() == 0) { if (aAh5 == null) { aAh5 = aAh; } if (aAh6 == null) { aAh6 = aAh3; } } else { if (aAh5 == null) { aAh5 = aAh3; } if (aAh6 == null) { aAh6 = aAh; } } setCompoundDrawablesRelativeWithIntrinsicBounds(aAh5, aAh2, aAh6, aAh4); } setCompoundDrawablesWithIntrinsicBounds(aAh, aAh2, aAh3, aAh4); w(aAh(attributeSet.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "background", 0))); this.CZK = new abpc.b(this, attributeSet, i, i2); if (this.CZK.uCC >= 0) { for (Drawable drawable : getCompoundDrawables()) { abpc.a(this.CZK.uCC, drawable); } if (Build.VERSION.SDK_INT >= 17) { for (Drawable drawable2 : getCompoundDrawablesRelative()) { abpc.a(this.CZK.uCC, drawable2); } } abpc.a(this.CZK.uCC, getBackground()); } } this.CZK = new abpc.b(); } private Drawable aAh(int i) { if (i == 0) { return null; } Resources resources = getResources(); String resourceTypeName = resources.getResourceTypeName(i); if (!isInEditMode() && abpc.CZW.contains(resourceTypeName)) { try { return new abow(resources, i); } catch (Resources.NotFoundException | IOException e) { } } return Build.VERSION.SDK_INT >= 21 ? resources.getDrawable(i, getContext().getTheme()) : resources.getDrawable(i); } private static void b(Drawable[] drawableArr) { for (Drawable drawable : drawableArr) { if (drawable != null) { drawable.setVisible(false, false); } } } private void w(Drawable drawable) { if (Build.VERSION.SDK_INT >= 16) { setBackground(drawable); } else { setBackgroundDrawable(drawable); } } /* access modifiers changed from: protected */ public void onDetachedFromWindow() { super.onDetachedFromWindow(); b(getCompoundDrawables()); if (Build.VERSION.SDK_INT >= 17) { b(getCompoundDrawablesRelative()); } } public void onRestoreInstanceState(Parcelable parcelable) { if (!(parcelable instanceof GifViewSavedState)) { super.onRestoreInstanceState(parcelable); return; } GifViewSavedState gifViewSavedState = (GifViewSavedState) parcelable; super.onRestoreInstanceState(gifViewSavedState.getSuperState()); Drawable[] compoundDrawables = getCompoundDrawables(); gifViewSavedState.b(compoundDrawables[0], 0); gifViewSavedState.b(compoundDrawables[1], 1); gifViewSavedState.b(compoundDrawables[2], 2); gifViewSavedState.b(compoundDrawables[3], 3); if (Build.VERSION.SDK_INT >= 17) { Drawable[] compoundDrawablesRelative = getCompoundDrawablesRelative(); gifViewSavedState.b(compoundDrawablesRelative[0], 4); gifViewSavedState.b(compoundDrawablesRelative[2], 5); } gifViewSavedState.b(getBackground(), 6); } public Parcelable onSaveInstanceState() { Drawable[] drawableArr = new Drawable[7]; if (this.CZK.CZY) { Drawable[] compoundDrawables = getCompoundDrawables(); System.arraycopy(compoundDrawables, 0, drawableArr, 0, compoundDrawables.length); if (Build.VERSION.SDK_INT >= 17) { Drawable[] compoundDrawablesRelative = getCompoundDrawablesRelative(); drawableArr[4] = compoundDrawablesRelative[0]; drawableArr[5] = compoundDrawablesRelative[2]; } drawableArr[6] = getBackground(); } return new GifViewSavedState(super.onSaveInstanceState(), drawableArr); } public void setBackgroundResource(int i) { w(aAh(i)); } @Override // android.widget.TextView public void setCompoundDrawablesRelativeWithIntrinsicBounds(int i, int i2, int i3, int i4) { setCompoundDrawablesRelativeWithIntrinsicBounds(aAh(i), aAh(i2), aAh(i3), aAh(i4)); } @Override // android.widget.TextView public void setCompoundDrawablesWithIntrinsicBounds(int i, int i2, int i3, int i4) { setCompoundDrawablesWithIntrinsicBounds(aAh(i), aAh(i2), aAh(i3), aAh(i4)); } public void setFreezesAnimation(boolean z) { this.CZK.CZY = z; } }